# Contributor: Renoir Boulanger <hello@renoirboulanger.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-yaml
_extname=yaml
pkgver=2.2.4
pkgrel=0
pkgdesc="YAML syntax bindings for PHP 8.1 - PECL"
url="https://pecl.php.net/package/yaml"
arch="all"
license="MIT"
_phpv=81
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev yaml-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/70_$_extname.ini
}

sha512sums="
f16a241ff54cc53017b29f13cf0683b254950429bbe627798b23c24cf0e938cdf9123cc53c028a0aca25de9e6e385e536695d65cd418271f8eef194fa9e234e5  php-pecl-yaml-2.2.4.tgz
"
